<?php
date_default_timezone_set("PRC");
//header("Content-type: text/html; charset=utf8");
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
require_once ('jpgraph/jpgraph_line.php');



$monthstr=$_GET['monthstr'];
$countstr=$_GET['countstr'];

$montharray=explode(",",$monthstr);
$countarray=explode(",",$countstr);

$xarray=array();
$yarray=array();


for($i=0;$i<count($montharray);$i+=1){
    $xarray[$i]=$montharray[$i];
}
for($i=0;$i<count($countarray);$i+=1){
    $yarray[$i]=(int)$countarray[$i];
}




$graph = new Graph(600,360);
$graph->img->SetMargin(90,50,50,50);
$graph->SetScale("textlin");
$graph->SetShadow();


//设置图表的标题字体、大小
$graph->title->Set(iconv("UTF-8","GB2312//IGNORE","year sales"));
$graph->xaxis->title->Set(iconv("UTF-8","GB2312//IGNORE","month"));
$graph->yaxis->title->Set(iconv("UTF-8","GB2312//IGNORE","sales"));
$graph->yaxis->title->SetMargin(10);
//和上面标题对应，设置标题的字体和大小
//$graph->title->SetFont(FF_SIMSUN,FS_BOLD,15);
//$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD,12);
//$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD,12);




$bar2 = new BarPlot($yarray);
$bar2->SetFillColor("red");
$bar2->value->Show();
$graph->xaxis->SetTickLabels($xarray);
//$gbar = new GroupbarPlot(array($bar2));

$graph->Add($bar2);

// Output line
$graph->Stroke();


?>


